/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.hiof.moraa.server.controller.restfulservice;

import com.hiof.moraa.server.service.AthleteHealthFeedService;
import com.hiof.moraa.server.service.MeetingPointService;
import com.hiof.moraa.server.service.model.Feed;
import com.hiof.moraa.server.service.model.MeetingPointInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Bergy
 */
@Controller
@RequestMapping("/restfulservice/meetingPoint")
public class MeetingPointController {

    @Autowired
    MeetingPointService meetingPointService;

    @RequestMapping(value = "/insert", method = RequestMethod.POST)
    @ResponseBody
    public MeetingPointInfo insertMeetingPoint(
            @RequestParam("teamId") int teamId,
            @RequestParam("lat") double lat,
            @RequestParam("lng") double lng,
            @RequestParam("height") double height) throws Exception {
        return meetingPointService.insertMeetingPoint(teamId, lat, lng, height);
    }

    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public void deleteMeetingPoint(
            @RequestParam("id") int id) throws Exception {
        meetingPointService.deleteMeetingPoint(id);    
    }

    @RequestMapping(value = "/getAll", method = RequestMethod.POST)
    @ResponseBody
    public List<MeetingPointInfo> getListOfMeetingPoints(
            @RequestParam("teamId") int teamId) throws Exception {
        return meetingPointService.getListOfMeetingPoint(teamId);
    }
}
